Skip to content

Conversation

@zyw-bot
Copy link
Collaborator

@zyw-bot zyw-bot commented Nov 1, 2025

Link: llvm/llvm-project#165748
Requested by: @dtcxzyw

@github-actions github-actions bot mentioned this pull request Nov 1, 2025
@zyw-bot
Copy link
Collaborator Author

zyw-bot commented Nov 1, 2025

Diff mode

runner: ariselab-64c-docker
baseline: llvm/llvm-project@225f4c6
patch: llvm/llvm-project#165748
sha256: bf4b2c49ad4070441a4f6258ea698962db56bb1683b175402d942988457b7dc8
commit: 2c16e9b

1584 files changed, 565768 insertions(+), 566738 deletions(-)

Improvements:
  loop-simplifycfg.NumLoopBlocksDeleted 6852 -> 6864 +0.18%
  gvn.NumPRELoopLoad 1997 -> 2000 +0.15%
  simplifycfg.NumBitMaps 2237 -> 2240 +0.13%
  loop-simplify.NumNested 11689 -> 11704 +0.13%
  loop-simplifycfg.NumLoopExitsDeleted 4215 -> 4220 +0.12%
  loop-simplifycfg.NumTerminatorsFolded 10808 -> 10818 +0.09%
  correlated-value-propagation.NumPhis 1239305 -> 1240307 +0.08%
  loop-idiom.NumMemCpy 8936 -> 8940 +0.04%
  sccp.NumGlobalConst 2453 -> 2454 +0.04%
  instcombine.NumExpand 2703 -> 2704 +0.04%
Regressions:
  simple-loop-unswitch.NumSwitches 1773 -> 1765 -0.45%
  correlated-value-propagation.NumDeadCases 65942 -> 65797 -0.22%
  memdep.NumCacheDirtyNonLocalPtr 23069 -> 23021 -0.21%
  licm.NumMinMaxHoisted 594 -> 593 -0.17%
  simplifycfg.NumLookupTablesHoles 2446 -> 2442 -0.16%
  indvars.NumFoldedUser 2100 -> 2099 -0.05%
  simplifycfg.NumLinearMaps 4187 -> 4186 -0.02%
  simple-loop-unswitch.NumCostMultiplierSkipped 17248 -> 17244 -0.02%
  adce.NumRemoved 95338 -> 95316 -0.02%
  sccp.NumInstRemoved 1952208 -> 1951797 -0.02%

+9 wasmtime-rs/5079e95b7v1wxko.ll
+6 git/unpack-trees.ll
+6 hermes/ConvertUTF.ll
+6 openssl/cipher_chacha20_poly1305_hw.ll
+6 quinn-rs/8ainv6dkvux55w82mlbamtdp2.ll
+5 z3/bv1_blaster_tactic.ll
+4 cmake/archive_read_support_format_cab.ll
+3 ffmpeg/dxv.ll
+3 ffmpeg/sbgdec.ll
+3 freetype/ftgzip.ll
+3 git/tree-walk.ll
+3 graphviz/exparse.ll
+3 icu/tridpars.ll
+3 libquic/a_mbstr.ll
+3 lvgl/lv_text.ll
+3 mini-lsm-rs/1m9jerzd56wr2irm.ll
+3 ncnn/deconvolutiondepthwise_x86_avx512.ll
+3 ruff-rs/5lvsb1nk0gwgenpfef7kaw01r.ll
+3 wasmtime-rs/48myxw210mngc99c.ll
+2 linux/msg.ll
+2 openssl/a_mbstr.ll
+2 openssl/core_namemap.ll
+2 openssl/handshake.ll
+1 darktable/introspection_temperature.ll
+1 lief/DyldChainedFixupsCreator.ll
+1 z3/for_each_expr.ll
+0 abc/wlnNtk.ll
+0 clamav/hwp.ll
+0 entt/meta_factory.ll
+0 glslang/hlslParseHelper.ll
+0 jemalloc/extent.ll
+0 opencv/bgfg_KNN.ll
+0 qemu/qemu-io-cmds.ll
+0 quickjs/libunicode.ll
-1 assimp/IFCOpenings.ll
-1 cvc5/term_database.ll
-1 freetype/type42.ll
-1 hwloc/bitmap.ll
-1 linux/kernel_read_file.ll
-1 llvm/CommandLine.ll
-2 arrow/expression.ll
-2 hdf5/H5Gdeprec.ll
-2 lief/ssl_tls13_client.ll
-2 linux/waitwake.ll
-2 llvm/Gnu.ll
-2 postgres/partprune.ll
-2 postgres/stem_UTF_8_arabic.ll
-2 rocksdb/wal_manager.ll
-3 openssl/bn_rsa_fips186_4.ll
-3 sdl/SDL_alsa_audio.ll
-4 hyperscan/ng_literal_analysis.ll
-4 libquic/pcy_tree.ll
-4 linux/dev-ioctl.ll
-4 llvm/StructurizeCFG.ll
-4 llvm/Visitor.ll
-5 icu/parse.ll
-5 llvm/X86InstCombineIntrinsic.ll
-6 hdf5/h5ls.ll
-6 yara-x-rs/etm5hpj33bdybcfrrsf9s3xwm.ll
-7 casadi/integrator.ll
-7 cvc5/theory_fp.ll
-7 llvm/OptimizePHIs.ll
-7 wireshark/packet-knet.ll
-7 z3/arith_eq_solver.ll
-7 z3/smt_context.ll
-8 wasmtime-rs/rpltamrj260p6v4.ll
-10 boost/get_turns_linear_areal.ll
-11 openjdk/cmstypes.ll
-12 duckdb/aes.ll
-13 proxygen/http_parser_cpp.ll
-13 wireshark/packet-usb-audio.ll
-16 wolfssl/api.ll
-17 wireshark/packet-pw-atm.ll
-22 cpp-httplib/httplib.ll
-45 meshlab/MarchingCubes.ll

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

Here is a summary of the major changes in the provided patch:

  1. Switch-to-Branch Transformations: Several switch instructions are replaced with conditional branches (br i1) using comparisons (e.g., icmp eq). This transformation simplifies control flow, particularly when the switch has only one or two cases. Examples include changes in arrow/optimized/expression.ll, cpp-httplib/optimized/httplib.ll, and duckdb/optimized/aes.ll.

  2. Unreachable Block Insertion: New unreachable blocks are introduced after switch statements to handle default labels explicitly, improving correctness and optimization opportunities. This appears in multiple files like ffmpeg/optimized/dxv.ll, freetype/optimized/ftgzip.ll, and openssl/optimized/bn_rsa_fips186_4.ll.

  3. Phi Node Updates: The order and incoming values of PHI nodes are adjusted to match updated control flow, especially after predecessor reordering or removal. This occurs in files such as git/optimized/tree-walk.ll, cvc5/optimized/term_database.ll, and assimp/optimized/IFCOpenings.ll.

  4. Control Flow Graph (CFG) Simplification: Redundant or unreachable predecessors are removed from basic blocks, and branch targets are reordered for clarity and efficiency. For example, .critedge blocks are cleaned up in linux/optimized/dev-ioctl.ll and hdf5/optimized/H5Gdeprec.ll.

  5. Memory Operation Optimization: Some memcpy calls are replaced with memmove or augmented with !tbaa.struct metadata to improve alias analysis and enable further optimizations, as seen in boost/optimized/get_turns_linear_areal.ll.

These changes collectively improve code clarity, correctness, and optimization potential by simplifying control flow, removing dead paths, and enhancing memory operation semantics.

model: qwen-plus-latest
CompletionUsage(completion_tokens=398, prompt_tokens=105217, total_tokens=105615, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this Nov 1, 2025
dtcxzyw added a commit to llvm/llvm-project that referenced this pull request Nov 4, 2025
…n of conditions (#165748)

In simplifycfg/cvp/sccp, we eliminate dead edges of switches according
to the knownbits/range info of conditions. However, these approximations
may not meet the real-world needs when the domain of condition values is
sparse. For example, if the condition can only be either -3 or 3, we
cannot prove that the condition never evaluates to 1 (knownbits:
???????1, range: [-3, 4)).
This patch adds a helper function `collectPossibleValues` to enumerate
all the possible values of V. To fix the motivating issue,
`eliminateDeadSwitchCases` will use the result to remove dead edges.

Note: In
https://discourse.llvm.org/t/missed-optimization-due-to-overflow-check/88700
I proposed a new value lattice kind to represent such values. But I find
it hard to apply because the transition becomes much complicated.

Compile-time impact looks neutral:
https://llvm-compile-time-tracker.com/compare.php?from=32d6b2139a6c8f79e074e8c6cfe0cc9e79c4c0c8&to=e47c26e3f1bf9eb062684dda4fafce58438e994b&stat=instructions:u
This patch removes many dead error-handling codes:
dtcxzyw/llvm-opt-benchmark#3012
Closes #165179.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 4, 2025
…o the domain of conditions (#165748)

In simplifycfg/cvp/sccp, we eliminate dead edges of switches according
to the knownbits/range info of conditions. However, these approximations
may not meet the real-world needs when the domain of condition values is
sparse. For example, if the condition can only be either -3 or 3, we
cannot prove that the condition never evaluates to 1 (knownbits:
???????1, range: [-3, 4)).
This patch adds a helper function `collectPossibleValues` to enumerate
all the possible values of V. To fix the motivating issue,
`eliminateDeadSwitchCases` will use the result to remove dead edges.

Note: In
https://discourse.llvm.org/t/missed-optimization-due-to-overflow-check/88700
I proposed a new value lattice kind to represent such values. But I find
it hard to apply because the transition becomes much complicated.

Compile-time impact looks neutral:
https://llvm-compile-time-tracker.com/compare.php?from=32d6b2139a6c8f79e074e8c6cfe0cc9e79c4c0c8&to=e47c26e3f1bf9eb062684dda4fafce58438e994b&stat=instructions:u
This patch removes many dead error-handling codes:
dtcxzyw/llvm-opt-benchmark#3012
Closes llvm/llvm-project#165179.
@dtcxzyw dtcxzyw deleted the test-run18996336007 branch November 7, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants